<%-- 
    Document   : newjsp
    Created on : Jul 26, 2013, 12:14:47 AM
    Author     : God
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="css/style.css" type="text/css">
        <title>JSP Page</title>
    </head>
    <body>
        <jsp:useBean id="productList" class="MyBean.ProductList"/>


        <div class="category-left" >
            <h2>Sản phẩm</h2><br/>
            <div class="box-category">
                <ul>
                    <li><a href="newjsp.jsp?catID=1">Điện thoại, viễn thông</a></li>
                    <li><a href="newjsp.jsp?catID=2">Máy tính, linh kiện</a></li>
                    <li><a href="newjsp.jsp?catID=3">Hàng thời trang</a></li>
                    <li><a href="newjsp.jsp?catID=4">Đồ dùng học tập</a></li>
                    <li><a href="newjsp.jsp?catID=5">Giải trí</a></li>
                </ul>
            </div>
        </div>
        <table>
            <div>
                <%
                    ResultSet rs = productList.ListByCategory(request.getParameter("catID"));
                    while (rs.next()) {
                        out.println("<tr><td><a href='ListProduct.jsp?productID=" + rs.getInt("productID") + "'>"
                                + rs.getString("productName") + "</a></td>");
                        out.println("<td><image width='250' src='");
                        out.println(rs.getString("imgURL"));//+rs.getString("description"));
                        out.println("'</td>");
                        out.println("</tr>");
                    }
                %>
            </div>
        </table>
    </body>
</html>
